package com.cbb.utils;

import android.os.Environment;

import java.io.File;

/**
 * Created by jxk on 2018/4/10 0010
 * Email:676585325@qq.com
 */

public class CacheUtils {
    /**
     * 应用的文件缓存
     */
    public static final String CACHE_PATH = Environment.getExternalStorageDirectory().getPath()
            + File.separator
            + "cbb.com";

    //创建缓存目录
    public static File getOrCreateFileInExternalStorage() {
        File cacheDir = new File(CACHE_PATH);
        if (!cacheDir.exists()) {
            cacheDir.mkdir();
        }
        return cacheDir;
    }

    //清除本地缓存
    public static void clearCache() {
        File file = getOrCreateFileInExternalStorage();
        //清除头像文件缓存
        CropUtils.clear(file);
        //清除JS文件缓存
        // JSCacheUtils.clear();
    }
}
